<template>
  <div>
    <van-cell-group >
      <van-field v-model="operation" name=""  placeholder="请输入"   ref="inputNumber" 
      autocomplete="off"   size="large"/>
    </van-cell-group>
    <van-button type="primary" @click="handleCopy">复制</van-button>
  </div>
</template>

<script setup>
import { getCurrentInstance ,ref} from 'vue';
import {copyText} from 'vue3-clipboard'
import { showToast, showConfirmDialog } from 'vant'

 // 需要复制的文本
 const operation = ref('')

 const handleCopy = () => {
  if (operation.value === '') {
    showToast('请输入')
    return
  }
  const text =window.btoa(operation.value)
  copyText(text, undefined, (error) => {
    if (error) {
      showToast('复制失败')
    } else {
      showToast('复制成功')
    }
  });
}
</script>

<style lang="scss" scoped>
 // 获取当前实例
 

</style>